<template>
    <a-table :columns="columns" :data-source="data" />
  </template>
  <script lang="ts" setup>
  import { ref } from 'vue';
  import {processInfo} from '@/store/modules/processInfo';
  import {handleTree,getFormDataJson,getSubsequentNodes} from '@/utils/common';
  import { getFormConf } from '@/api/form/index';


  const processInfoStore = processInfo();
  const data=ref<DataItem[]>();
  const columns = [
    {
      title: '参数编码',
      dataIndex: 'id',
      key: 'id',
    },
    {
      title: '参数类型',
      dataIndex: 'compType',
      key: 'compType',
      customRender: ({ record }) => {
        if(record.compType=="0"){
            return "对象";
        }
        if(record.compType=="input"){
            return "字符串";
        }
        if(record.compType=="inputNumber"){
            return "数值";
        }
        if(record.compType=="3"){
            return "布尔";
        }
      },
    },
    {
      title: '参数说明',
      dataIndex: 'label',
      key: 'label',
    },
  ];
  
  interface DataItem {
    key: number;
    name: string;
    age: number;
    address: string;
    children?: DataItem[];
  }

  const loadData=async()=>{
    const formConfItemList= await getFormConf({id:processInfoStore.procInfo.formId});
    if (formConfItemList.result.form_json!=null&&formConfItemList.result.form_json!='') {
      const mapJSON = JSON.parse(formConfItemList.result.form_json);
      data.value=getFormDataJson(mapJSON.list);
    }
  }
  loadData();
  


  </script>
  
  